using System;

namespace Bookvar.ObjectModel.Actions
{
    /// <summary>
    /// An action contains the actual logic for executing an operation in Bookvar. Some actions support undo/redo,
    /// while other don't. The <see cref="Execute"/> method is used both for redo and execute, because most of the time 
    /// the redo and execute logic is the same. Usually an action should not be executed on its own - 
    /// it should be passed to <c>IActionService</c> for execution.
    /// </summary>
    public interface IAction : IDisposable
    {
        /// <summary>
        /// Gets a value indicating whether this action supports redo.
        /// </summary>
        /// <value><c>true</c> if this action supports redo; otherwise, <c>false</c>.</value>
        bool CanRedo { get; }

        /// <summary>
        /// Gets a value indicating whether this action supports undo.
        /// </summary>
        /// <value><c>true</c> if his action supports undo; otherwise, <c>false</c>.</value>
        bool CanUndo { get; }

        /// <summary>
        /// Executes (or redoes) the logic for the action.
        /// </summary>
        void Execute();

        /// <summary>
        /// Undoes the action.
        /// </summary>
        void Undo();
    }
}